import service from '/@/utils/request_types';
import { AxiosRequestConfig } from 'axios';
import { NumberFormatOptions } from '@intlify/core-base';

interface MyResponseType<T = any> {
	code: number;
	message: string;
	extras: any;
	success: boolean;
	timestamp: number;
	data: T;
}

interface MyRequestTypes extends AxiosRequestConfig {
	multiPartFormData?: boolean; //  用来区分是否用 apllication/json 还是 multipart/formdata
}

const request = async <T = any>(config: MyRequestTypes): Promise<MyResponseType<T>> => {
	let res = await service.request<MyResponseType<T>>(config);
	return res.data;
};

export default request;
